package com.hksj.gas.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hksj.common.core.model.Rest;
import com.hksj.gas.dto.GasDeviceDTO;
import com.hksj.gas.dto.GasDeviceDetailsDTO;
import com.hksj.gas.service.GasDeviceService;
import com.hksj.gas.vo.GasDeviceTimeVO;
import com.hksj.gas.vo.GasDeviceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

@Api(tags = "医气监测-医气设备管理")
@RequestMapping("/gas/gasDevice")
@RestController
public class GasDeviceController {

    @Autowired
    private GasDeviceService gasDeviceService;

    @ApiOperation(value = "分页查询设备状态列表-压力",response = GasDeviceVO.class)
    @PostMapping("/queryPressureGasDeviceListByPage")
    public Rest<IPage<GasDeviceVO>> queryPressureGasDeviceListByPage(@RequestBody GasDeviceDTO dto){
        return Rest.ok(gasDeviceService.queryPressureGasDeviceListByPage(dto));
    }

    @ApiOperation(value = "分页查询设备状态列表-流量",response = GasDeviceVO.class)
    @PostMapping("/queryFlowGasDeviceListByPage")
    public Rest<IPage<GasDeviceVO>> queryFlowGasDeviceListByPage(@RequestBody GasDeviceDTO dto){
        return Rest.ok(gasDeviceService.queryFlowGasDeviceListByPage(dto));
    }

    @ApiOperation(value = "查询设备压力趋势")
    @PostMapping("/queryDeviceDetailsList")
    public Rest<IPage<GasDeviceTimeVO>> queryDeviceDetailsList(@RequestBody GasDeviceDetailsDTO dto){
        return Rest.ok(gasDeviceService.queryDeviceDetailsList(dto));
    }

    @ApiOperation(value = "查询设备流量使用趋势")
    @PostMapping("/queryFlowDeviceList")
    public Rest<IPage<GasDeviceTimeVO>> queryFlowDeviceList(@RequestBody GasDeviceDetailsDTO dto){
        return Rest.ok(gasDeviceService.queryFlowDeviceList(dto));
    }

    @ApiOperation(value = "导出设备压力趋势")
    @PostMapping("/exportPressureDeviceInfo")
    public void exportPressureDeviceInfo(@RequestBody GasDeviceDetailsDTO dto, HttpServletResponse response) throws Exception{
        gasDeviceService.exportPressureDeviceInfo(dto,response);
    }

    @ApiOperation(value = "导出设备流量使用趋势")
    @PostMapping("/exportFlowDeviceInfo")
    public void exportFlowDeviceInfo(@RequestBody GasDeviceDetailsDTO dto,HttpServletResponse response) throws Exception{
        gasDeviceService.exportFlowDeviceInfo(dto,response);
    }

}
